home *** CD-ROM | disk | FTP | other *** search
/ Champak 40 / Vol 40.iso / games / table_so.swf / scripts / __Packages / mx / transitions / easing / Elastic.as < prev    next >
Encoding:
Text File  |  2007-03-21  |  1.8 KB  |  87 lines

  1. class mx.transitions.easing.Elastic
  2. {
  3.    static var version = "1.1.0.52";
  4.    function Elastic()
  5.    {
  6.    }
  7.    static function easeIn(t, b, c, d, a, p)
  8.    {
  9.       if(t == 0)
  10.       {
  11.          return b;
  12.       }
  13.       if((t /= d) == 1)
  14.       {
  15.          return b + c;
  16.       }
  17.       if(!p)
  18.       {
  19.          p = d * 0.3;
  20.       }
  21.       if(!a || a < Math.abs(c))
  22.       {
  23.          a = c;
  24.          var _loc7_ = p / 4;
  25.       }
  26.       else
  27.       {
  28.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  29.       }
  30.       return - a * Math.pow(2,10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) + b;
  31.    }
  32.    static function easeOut(t, b, c, d, a, p)
  33.    {
  34.       if(t == 0)
  35.       {
  36.          return b;
  37.       }
  38.       if((t /= d) == 1)
  39.       {
  40.          return b + c;
  41.       }
  42.       if(!p)
  43.       {
  44.          p = d * 0.3;
  45.       }
  46.       if(!a || a < Math.abs(c))
  47.       {
  48.          a = c;
  49.          var _loc7_ = p / 4;
  50.       }
  51.       else
  52.       {
  53.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  54.       }
  55.       return a * Math.pow(2,-10 * t) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) + c + b;
  56.    }
  57.    static function easeInOut(t, b, c, d, a, p)
  58.    {
  59.       if(t == 0)
  60.       {
  61.          return b;
  62.       }
  63.       if((t /= d / 2) == 2)
  64.       {
  65.          return b + c;
  66.       }
  67.       if(!p)
  68.       {
  69.          p = d * 0.44999999999999996;
  70.       }
  71.       if(!a || a < Math.abs(c))
  72.       {
  73.          a = c;
  74.          var _loc7_ = p / 4;
  75.       }
  76.       else
  77.       {
  78.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  79.       }
  80.       if(t < 1)
  81.       {
  82.          return -0.5 * (a * Math.pow(2,10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p)) + b;
  83.       }
  84.       return a * Math.pow(2,-10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) * 0.5 + c + b;
  85.    }
  86. }
  87.